package com.cskaoyan.controller.extendController;

import com.cskaoyan.model.bean.Topic;
import com.cskaoyan.model.bo.extend.TopicBo;
import com.cskaoyan.model.vo.extend.BaseRespVo;
import com.cskaoyan.model.vo.extend.TopicVo;
import com.cskaoyan.service.TopicService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：Chunk
 * @Description:
 * @Date Created in 10:34 2021/4/10
 */
@RestController
@RequestMapping("admin/topic")
public class TopicController {
    @Autowired
    TopicService topicService;
    @RequestMapping("list")
    public BaseRespVo topicList(TopicBo topicBo){
        TopicVo topicVo = topicService.topicList(topicBo);
        return BaseRespVo.ok(topicVo);
    }

    @RequestMapping("create")
    public BaseRespVo topicCreate(@RequestBody Topic topic){
        Topic topicVo = topicService.topicCreate(topic);
        return BaseRespVo.ok(topicVo);
    }

    @RequestMapping("update")
    public BaseRespVo topicUpdate(@RequestBody Topic topic){
        Topic topicVo = topicService.topicUpdate(topic);
        return BaseRespVo.ok(topicVo);
    }

    @RequestMapping("delete")
    public BaseRespVo topicDelete(@RequestBody Topic topic){
        topicService.topicDelete(topic);
        return  BaseRespVo.ok();
    }
}
